package com.zlx.mall.basic.signature;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.time.Duration;

/**
 * @author qingke
 **/
@Component
public class SignatureProperties {

    public static String SECRET;
    public static Duration TIMESTAMP_TTL;

    @Value("${hzl.app.signature.secret}")
    public void setSecret(String secret) {
        SignatureProperties.SECRET = secret;
    }

    @Value("${hzl.app.signature.timestamp.ttl}")
    public void setTimestampTtl(String ttl) {
        SignatureProperties.TIMESTAMP_TTL = Duration.parse(ttl);
    }

    public static String getSecret() {
        return SECRET;
    }

    public static Duration getTimestampTtl() {
        return TIMESTAMP_TTL;
    }
}
